<?php
$row = $obj_member->row();
?>
<script src="<?php echo base_url(); ?>js/jquery/jquery.md5.js" type="text/javascript"></script>
<script type="text/javascript">
    var array = [];
    $(document).ready(function() {
        function validate_input(attname, attinput, atterror) {
            if (!attname) {
                $(attinput).attr('class', "inp-form-error");
                $(atterror).attr('style', 'visibility:visible');
                array.push(false);
            } else {
                $(attinput).attr('class', "inp-form");
                $(atterror).attr('style', 'visibility:hidden');
                array.push(true);
            }
        }

        function validate_pass() {
            $valuNewPwd = $("input[name='newPassword']").val();
            $valueConfNewPwd = $("input[name='confNewPassword']").val();
            $errorOldPwd = "div[id='error_oldPwd']";
            $errorNewPwd = "div[id='error_newPwd']";
            $errorConfNewPwd = "div[id='error_confNewPwd']";
                    if ($valuNewPwd && $valueConfNewPwd) {
                        if ($valuNewPwd != $valueConfNewPwd) {
                            $($errorNewPwd).attr('style', 'visibility:visible');
                            $($errorConfNewPwd).attr('style', 'visibility:visible');
                            document.getElementById("error_newPwd_field").innerHTML = 'New Password is not same.';
                            document.getElementById("error_confNewPwd_field").innerHTML = 'Confirm New Password is not same.';
                            array.push(false);
                        } else {
                            $($valuNewPwd).attr('style', 'visibility:hidden');
                            $($valueConfNewPwd).attr('style', 'visibility:hidden');
                            array.push(true);
                        }
                    } else {
                        validate_input($valuNewPwd, $valuNewPwd, $errorNewPwd);
                        validate_input($valueConfNewPwd, $valueConfNewPwd, $errorConfNewPwd);
                    }
               
        }


        //validate form
        $("input[name='submit']").click(function() {
            array.length = 0;
            validate_pass();
            for (var i in array) {
                if (!array[i]) {
                    return false;
                    break;
                }
            }
        });
        $("button[name='reset']").click(function() {
            $("input[name='oldPassword']").val('');
            $("input[name='newPassword']").val('');
            $("input[name='confNewPassword']").val('');
        });
        // keypress event only numer
        $("input[name='signup_idCard']").bind('keypress', function(e) {
            return (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) ? false : true;
        });
        $("input[name='signup_mobile']").bind('keypress', function(e) {
            return (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) ? false : true;
        });
    });
</script>

<div id="content-outer">
    <div id="content">
        <div id="page-heading"><h1>Forget Password</h1></div>
        <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
            <tbody>
                <tr>
                    <th rowspan="3" class="sized"><img src="<?php echo base_url(); ?>images/shared/side_shadowleft.jpg" width="20" height="300" alt=""></th>
                    <th class="topleft"></th>
                    <td id="tbl-border-top">&nbsp;</td>
                    <th class="topright"></th>
                    <th rowspan="3" class="sized"><img src="<?php echo base_url(); ?>images/shared/side_shadowright.jpg" width="20" height="300" alt=""></th>
                </tr>
                <tr>
                    <td id="tbl-border-left"></td>
                    <td>
                        <!--  start content-table-inner -->
                        <div id="content-table-inner">

                            <table border="0" width="100%" cellpadding="0" cellspacing="0">

                                <tbody><tr valign="top">
                                        <td>


                                            <!-- start id-form -->
                                            <table border="0" cellpadding="0" cellspacing="0" id="id-form">
                                                <?php
                                                echo form_open('ForgetPassword/SubmitChangePwd');
                                                ?>
                                                <tbody>
                                                    <tr>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th valign="top">New Password:</th>
                                                        <td>
                                                            <?php
                                                            echo form_password('newPassword', '', 'class="inp-form"');
                                                            ?> 
                                                        </td>
                                                        <td style="width:500px">
                                                            <div width="400px" id="error_newPwd" style="visibility:hidden">
                                                                <div class="error-left"></div>
                                                                <div id="error_newPwd_field" class="error-inner">This field is required.</div>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th valign="top">Confirm New Password:</th>
                                                        <td>
                                                            <?php
                                                            echo form_password('confNewPassword', '', 'class="inp-form"');
                                                            ?> 
                                                        </td>
                                                        <td style="width:500px">
                                                            <div width="400px" id="error_confNewPwd" style="visibility:hidden">
                                                                <div class="error-left"></div>
                                                                <div id="error_confNewPwd_field" class="error-inner">This field is required.</div>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            &nbsp;
                                                            <?php
                                                            echo form_input('idMember', $row->ID, 'class="inp-form" hidden="true"');
                                                            ?> 
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>&nbsp;</th>
                                                        <td valign="top">
                                                            <?php echo form_submit('submit', 'Submit', 'class="form-submit"'); ?>
                                                            <?php echo form_button('reset', 'Reset', 'class="form-reset"'); ?>
                                                        </td>
                                                        <td></td>
                                                    </tr>
                                                </tbody>
                                                <?php echo form_close(); ?>
                                            </table>
                                            <!-- end id-form  -->

                                        </td>
                                        <td>



                                        </td>
                                    </tr>
                                    <tr>
                                        <td><img src="images/shared/blank.gif" width="695" height="1" alt="blank"></td>
                                        <td></td>
                                    </tr>
                                </tbody></table>


                            <div class="clear"></div>


                        </div>
                        <!--  end content-table-inner  -->
                    </td>
                    <td id="tbl-border-right"></td>
                </tr>
                <tr>
                    <th class="sized bottomleft"></th>
                    <td id="tbl-border-bottom">&nbsp;</td>
                    <th class="sized bottomright"></th>
                </tr>
            </tbody></table>

        <div class="clear">&nbsp;</div>
    </div>
</div>